package com.weic.manager.index.controller;

import com.weic.manager.controller.BaseController;
import com.weic.manager.user.mapper_service.UserService;
import com.weic.manager.user.vo.UserVO;
import com.weic.manager.utils.WUtils;
import com.weic.manager.utils.WebUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 首页，用于一些默认页面请求
 */
@Controller
public class IndexController extends BaseController {

    @RequestMapping({"","/index.html"})
    public String index(HttpServletRequest request,HttpServletResponse response){
        if(!WUtils.isEmpty(WebUtils.getLoginInfo()) && !WUtils.isEmpty(WebUtils.getLoginInfo().getUserVO())){
            request.setAttribute("userVO",WebUtils.getLoginInfo().getUserVO());
        }
        return "/index.jsp";
    }

    @RequestMapping(value = "/index/evaluation.html")
    public ModelAndView evaluationPage(HttpServletRequest request){
        String pageName = request.getParameter("pageName");
        return new ModelAndView("/ceshi/"+pageName+".html");
    }
}
